package com.beans;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: Administrator
 * \* Date: 2022/7/8
 * \* Time: 15:10
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */

/**
 * 根据属性实现bean对象注入
 */
@Controller
public class UserController2 {

    //对象注入方式 ：1.属性注入,告诉spring，加载UserController2这个
    //类的时候，首先将userService对象注入这个类里面
    @Autowired
    private UserService userService;

    public void sayhi(){
        userService.sayHi();
    }
}
